<template>
  <el-dialog title="就诊信息" :close-on-click-modal="false" :visible.sync="visible" fullscreen center >
    <div class="mod-config" style="padding: 0 15px;">
      <!-- <basic-container style="height: 100%;"> -->
      <div class="custom-info-box">
        <!-- 客户基础信息 -->
        <div class="custom-box">
          <div class="custom-item"><span>姓名：</span><span>{{registerForm.personName}}</span></div>
          <div class="custom-item">
            <span>性别：</span>
            <span v-if="dataForm.gender == 0">男</span>
            <span v-if="dataForm.gender == 1">女</span>
          </div>
          <div class="custom-item"><span>年龄：</span><span>{{registerForm.age}}岁</span></div>
          <div class="custom-item"><span>联系方式：</span><span>{{registerForm.telphone}}</span></div>
          <div class="custom-item"><span>就诊事项：</span><span>{{registerForm.registerConfigName}}</span></div>
          <div class="custom-item"><span>费别：</span><span>{{registerForm.payType==1?'自费':'医保'}}</span></div>
          <div class="custom-item"><span>患者ID：</span><span>{{registerForm.uniqueCode}}</span></div>
          <div style="position: absolute;right: 0;top: 3px;">
            <el-button size="mini" type="primary" icon="el-icon-caret-bottom" @click="openOrClose"></el-button>
          </div>
        </div>
        <!-- 客户详细信息 -->
        <div class="custom-box" v-if="infoVisible">
          <div class="custom-item"><span>{{registerForm.address}}</span></div>
        </div>
      </div>
      <el-tabs class="tabs-info-box" :class="infoVisible?'info-show':''" type="border-card" v-model="activeName"
               @tab-click="tabsChange">
        <el-tab-pane class="" label="预检" name='preCheck' v-if="preCheck">
          <el-form label-width="44px">
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">身高:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label-width="40px">
                  <el-input class="input-width-217" v-model="dataForm.height" placeholder="身高"><span slot="append">KG</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="体重:">
                  <el-input class="input-width-217" v-model="dataForm.weight" placeholder="体重"><span slot="append">CM</span></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">裸眼远视力:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="右眼">
                  <el-input class="input-width-217" v-model="dataForm.nakedOd"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="左眼">
                  <el-input class="input-width-217" v-model="dataForm.nakedOs"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0" >眼压:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="右眼">
                  <el-input class="input-width-217"  v-model="dataForm.iopOd"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="左眼">
                  <el-input class="input-width-217"  v-model="dataForm.iopOs"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">眼前段及眼附属器:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="右眼">
                  <el-radio-group v-model="dataForm.frontOd" >
                    <el-radio :label="0">正常</el-radio>
                    <el-radio :label="1">异常发现</el-radio>
                  </el-radio-group>
                  <el-input class="input-width-217" v-if="dataForm.frontOd == 1"  v-model="dataForm.frontOdText"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="左眼">
                  <el-radio-group v-model="dataForm.frontOs">
                    <el-radio :label="0">正常</el-radio>
                    <el-radio :label="1">异常发现</el-radio>
                  </el-radio-group>
                  <el-input class="input-width-217" v-if="dataForm.frontOs == 1"  v-model="dataForm.frontOsText"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">眼底检查:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="右眼">
                  <el-select class="input-width-217" v-model="dataForm.fundusOd">
                    <el-option v-for="item in fundusOptions" :key="item.value" :value="item.value" :label="item.name"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="左眼">
                  <el-select class="input-width-217" v-model="dataForm.fundusOs">
                    <el-option v-for="item in fundusOptions" :key="item.value" :value="item.value" :label="item.name"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">眼位:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item>
                  <el-radio-group v-model="dataForm.eyePosition" style="margin-right: 15px">
                    <el-radio label="0">正位</el-radio>
                    <el-radio label="1">隐斜</el-radio>
                    <el-radio label="2">显斜</el-radio>
                  </el-radio-group>
                  <el-input class="input-width-217" v-if="dataForm.eyePosition == 1" v-model="dataForm.eyePositionText" placeholder="隐斜现象"></el-input>
                  <el-input class="input-width-217" v-if="dataForm.eyePosition == 2" v-model="dataForm.eyePositionText" placeholder="显斜现象"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="集合近点(NPC)" label-width="120px">
                  <el-input class="input-width-217" v-model="dataForm.nearPoint" placeholder="集合近点(NPC)">
                    <span slot="append">cm</span>
                  </el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">优势眼:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label-width="40px">
                  <el-radio-group v-model="dataForm.dominantEye" >
                    <el-radio label="Y">右眼</el-radio>
                    <el-radio label="Z">左眼</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="色觉:">
                  <el-input class="input-width-217" v-model="dataForm.colorSense" placeholder="色觉"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="病史" name="history" v-if="!preCheck">
          <el-form label-width="80px">
                <el-form-item label="主诉">
                  <el-input type="textarea" v-model="dataForm.chiefComplaint" placeholder="主诉"></el-input>
                </el-form-item>
                <el-form-item label="现病史">
                  <el-input type="textarea" v-model="dataForm.hisPresentTalk" placeholder="现病史"></el-input>
                </el-form-item>
                <el-form-item label="既往史">
                  <el-checkbox-group v-model="checkList">
                    <el-checkbox label="疾病史" value="1"></el-checkbox>
                    <el-checkbox label="过敏史" value="2"></el-checkbox>
                    <el-checkbox label="手术史" value="3"></el-checkbox>
                    <el-checkbox label="家族史" value="4"></el-checkbox>
                  </el-checkbox-group>
                </el-form-item>
            <el-row v-if="!checkList.length">
              <h1>无既往史</h1>
            </el-row>


                  <el-form-item v-else :label="item" v-for="(item,index) in checkList" :key="index">
                    <el-input v-if="item == '疾病史'" type="textarea"   v-model="dataForm.diseaseHistory" ></el-input>
                    <el-input v-if="item == '过敏史'" type="textarea"  v-model="dataForm.allergyHistory"></el-input>
                    <el-input v-if="item == '手术史'" type="textarea" v-model="dataForm.operationHistory"></el-input>
                    <el-input v-if="item == '家族史'" type="textarea" v-model="dataForm.familyHistory"></el-input>
                  </el-form-item>


          </el-form>
        </el-tab-pane>
        <el-tab-pane label="体格检查" name="three"  v-if="!preCheck">

          <el-form label-width="44px">
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">身高:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label-width="40px">
                  <el-input class="input-width-217" v-model="dataForm.height" placeholder="身高"><span slot="append">KG</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="体重:">
                  <el-input class="input-width-217" v-model="dataForm.weight" placeholder="体重"><span slot="append">CM</span></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">裸眼远视力:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="右眼">
                  <el-input class="input-width-217" v-model="dataForm.nakedOd"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="左眼">
                  <el-input class="input-width-217" v-model="dataForm.nakedOs"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0" >眼压:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="右眼">
                  <el-input class="input-width-217"  v-model="dataForm.iopOd"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="左眼">
                  <el-input class="input-width-217"  v-model="dataForm.iopOs"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">眼前段及眼附属器:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="右眼">
                  <el-radio-group v-model="dataForm.frontOd" >
                    <el-radio :label="0">正常</el-radio>
                    <el-radio :label="1">异常发现</el-radio>
                  </el-radio-group>
                  <el-input class="input-width-217" v-if="dataForm.frontOd == 1"  v-model="dataForm.frontOdText"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="左眼">
                  <el-radio-group v-model="dataForm.frontOs">
                    <el-radio :label="0">正常</el-radio>
                    <el-radio :label="1">异常发现</el-radio>
                  </el-radio-group>
                  <el-input class="input-width-217" v-if="dataForm.frontOs == 1"  v-model="dataForm.frontOsText"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">眼底检查:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="右眼">
                  <el-select class="input-width-217" v-model="dataForm.fundusOd">
                    <el-option v-for="item in fundusOptions" :key="item.value" :value="item.value" :label="item.name"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="左眼">
                  <el-select class="input-width-217" v-model="dataForm.fundusOs">
                    <el-option v-for="item in fundusOptions" :key="item.value" :value="item.value" :label="item.name"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">眼位:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item>
                  <el-radio-group v-model="dataForm.eyePosition" style="margin-right: 15px">
                    <el-radio label="0">正位</el-radio>
                    <el-radio label="1">隐斜</el-radio>
                    <el-radio label="2">显斜</el-radio>
                  </el-radio-group>
                  <el-input class="input-width-217" v-if="dataForm.eyePosition == 1" v-model="dataForm.eyePositionText" placeholder="隐斜现象"></el-input>
                  <el-input class="input-width-217" v-if="dataForm.eyePosition == 2" v-model="dataForm.eyePositionText" placeholder="显斜现象"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="集合近点(NPC)" label-width="120px">
                  <el-input class="input-width-217" v-model="dataForm.nearPoint" placeholder="集合近点(NPC)">
                    <span slot="append">cm</span>
                  </el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="4" style="text-align: right;">
                <el-form-item>
                  <el-form-item label-width="0">优势眼:</el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label-width="40px">
                  <el-radio-group v-model="dataForm.dominantEye" >
                    <el-radio label="Y">右眼</el-radio>
                    <el-radio label="Z">左眼</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="色觉:">
                  <el-input class="input-width-217" v-model="dataForm.colorSense" placeholder="色觉"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="验光" name="optometry"  v-if="!preCheck">

          <el-table :data="checkedItems" border style="width: 100%">
            <el-table-column prop="name" label="项目名称" header-align="center" align="center" width="480"></el-table-column>
            <el-table-column prop="num" label="数量" header-align="center" align="center" width="180"></el-table-column>
            <el-table-column prop="price" label="单价" header-align="center" align="center"></el-table-column>
            <el-table-column prop="address" label="操作" header-align="center" align="center">
              <template slot-scope="scope">
                <el-button type="danger" v-if="registerForm.status==4" size="mini" icon="el-icon-delete" @click="deleteHandle(scope.row.id)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <el-table :data="tableData" border style="width: 100%" :show-header="false">
            <el-table-column prop="date" width="480" header-align="center" align="center">
              <template slot-scope="scope">
                <el-select v-model="checkValue" @change="checkItemChange">
                  <el-option v-for="item in itemOptions" :value="item.id" :label="item.name" :key="item.id"></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column prop="num" width="180" header-align="center" align="center"></el-table-column>
            <el-table-column prop="address" header-align="center" align="center"></el-table-column>

          </el-table>
        </el-tab-pane>
        <el-tab-pane label="辅助检查" name="otherCheck"  v-if="!preCheck">

          <el-table :data="checkedItems" border style="width: 100%">
            <el-table-column prop="name" label="项目名称" header-align="center" align="center" width="480"></el-table-column>
            <el-table-column prop="num" label="数量" header-align="center" align="center" width="180"></el-table-column>
            <el-table-column prop="price" label="单价" header-align="center" align="center"></el-table-column>
            <el-table-column prop="address" label="操作" header-align="center" align="center">
              <template slot-scope="scope">
                <el-button type="danger" v-if="registerForm.status==4" size="mini" icon="el-icon-delete" @click="deleteHandle(scope.row.id)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <el-table :data="tableData" border style="width: 100%" :show-header="false">
            <el-table-column prop="date" width="480" header-align="center" align="center">
              <template slot-scope="scope">
                <el-select v-model="checkValue" @change="checkItemChange">
                  <el-option v-for="item in itemOptions" :value="item.id" :label="item.name" :key="item.id"></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column prop="num" width="180" header-align="center" align="center"></el-table-column>
            <el-table-column prop="address" header-align="center" align="center"></el-table-column>

          </el-table>
          <el-row>
            <el-col :span="24">
              <el-button type="primary" v-if="registerForm.status==5" @click="recordCheckResult">录入检查结果</el-button>
            </el-col>
          </el-row>
        </el-tab-pane>
        <el-tab-pane label="诊断" name="diagnose"  v-if="!preCheck">
          <el-form label-width="80px">
            <el-form-item label="门诊诊断">
              <el-input type="textarea" v-model="dataForm.doctorAdvice" placeholder="门诊诊断"></el-input>
            </el-form-item>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="处方" name="recipel"  v-if="!preCheck">
          <el-form>
            <el-row>
              <el-col>
                <el-form-item v-if="registerForm.status==5||registerForm.status==6" label="处方类型">
                  <el-select v-model="optType">
                    <el-option v-for="item in bizData.optTypeData" :value="item.value" :label="item.label" :key="item.value"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <opt-form v-if="registerForm.status==5||registerForm.status==6" :optometry-data="optometry"  :optType="optType" :source="'register'"></opt-form>
          </el-form>
        </el-tab-pane>
      </el-tabs>



      <div class="button-info-box">
        <el-button @click="visible = false">取 消</el-button>
        <template v-if="registerForm.status==2">
          <el-button type="primary" @click="preSave" v-prevent-re-click>保 存</el-button>
        </template>
        <template v-if="registerForm.status==3">
          <el-button type="primary" @click="updateItemInfo" v-prevent-re-click>保 存</el-button>
        </template>
        <template v-if="registerForm.status==4||this.registerForm.status==5">
          <el-button type="primary" @click="saveInfo" v-prevent-re-click>保 存</el-button>
          <el-button v-if="registerForm.status==5" type="primary" @click="finish" v-prevent-re-click>结束就诊</el-button>
        </template>
      </div>
      <check-result v-if="resultVisible" ref="checkResult" :data="this.dataForm.checkedItems" :id="this.dataForm.id" :registerForm="registerForm"></check-result>
      <!-- </basic-container> -->
    </div>
  </el-dialog>
</template>
<script>
    import { filterParams} from '@/util/tools'
    import { getSaleOptometry,saveSaleOptometry,updateSaleOptometry} from '@/api/eims/sale'
    import { getObj, saveChkData, putObj, preSave, updateItemInfo,finishChkData } from '@/api/chkdata/chkdata'
    import { checkItemFetchItem } from '@/api/def/checkItem'
    import { getRegister } from '@/api/eims/cashier/register'
    import { mapGetters } from 'vuex'
    import { remote } from '@/api/admin/dict'
    import CheckResult from './checkresult-form'
    import OptForm from './opt-form'
    export default {
        data() {
            return {
                visible: false,
                infoVisible: false,
                activeName: 'preCheck',
                dataForm: {
                    dominantEye:'Y'
                },
                preCheck:true,
                optometry: {},
                registerForm: {},
                checkList: [],
                optType: '',
                disease: '',
                allergy: '',
                operation: '',
                family: '',
                inspect: '0',
                checkedItems: [],
                fundusOptions: [],
                tableData: [{ num: '1', name: '王小虎', address: '' }],
                checkValue: '',
                itemOptions: [],
                resultVisible: false
            }
        },
        components: {
            CheckResult,
            OptForm
        },
        computed: {
            ...mapGetters(['permissions', 'isCollapse', 'bizData'])
        },
        methods: {
            // 打开弹窗，初始化数据
            init(id, personId, type) {

                this.dataForm.id = id || 0
                this.visible = true
                this.$nextTick(() => {
                    //this.$refs['dataForm'].resetFields()

                    if (type == 'register') {
                        if (this.dataForm.id) {
                            this.preCheck=true
                            this.activeName='preCheck'
                            getRegister(this.dataForm.id).then(response => {
                                this.registerForm = response.data.data
                                this.dataForm.personId=this.registerForm.personId
                                this.dataForm.registerId=this.registerForm.id
                            })
                        }
                    } else {
                        if (this.dataForm.id) {
                            this.preCheck=false
                            this.activeName='history'
                            getObj(this.dataForm.id).then(response => {
                                this.dataForm = response.data.data
                                getRegister(this.dataForm.registerId).then(response => {
                                    this.registerForm = response.data.data
                                    if(this.registerForm.status==5){
                                        let params={dataId:this.dataForm.id,dataTbl:'chk_data'}
                                        getSaleOptometry(params).then(response => {
                                            this.optometry = response.data.data
                                            this.optType= this.optometry.optType
                                        })
                                    }
                                })

                                this.checkedItems=this.dataForm.checkedItems
                            })
                        }
                    }
                    checkItemFetchItem().then(result => {
                        this.itemOptions = result.data.data
                    })
                })
                remote('fundus').then(result => {
                    this.fundusOptions = result.data.data
                })
            },
            // 打开或关闭客户详情信息
            openOrClose() {
                this.infoVisible = !this.infoVisible
            },
            tabsChange(tab, event) {
                if (tab.name == 'five') {
                    console.log(this.checkList)
                }
            },
            //  检查项目改变
            checkItemChange(val){
                let obj = {}
                obj = this.itemOptions.find(item => {
                    return item.id == val
                })
                let result = this.checkedItems.some(item => {
                    if(item.id == obj.id){
                        return true
                    }
                })
                if(!result) {
                    obj.num = 1
                    this.checkedItems.push(obj)
                }else{
                    this.$message.warning('该检查项已经添加过了')
                }
                this.checkValue = ''
            },
            //  删除检查项目
            deleteHandle(id){
                this.checkedItems.forEach((item,index) => {
                    if(item.id == id){
                        this.checkedItems.splice(index,1)
                    }
                })
            },
            preSave() {
                let list = []
                if(!this.registerForm.id){
                    this.$message.warning('请选择就诊数据')
                    return false
                }
                preSave(this.dataForm).then(result => {
                    if(result.data.code == 0) {
                        this.$message.success('保存成功')
                        this.visible = false
                        this.$emit('refreshDataList')
                    }
                })
            },
            updateItemInfo() {
                let list = []
                if(!this.registerForm.id){
                    this.$message.warning('请选择就诊数据')
                    return false
                }
                if(this.checkedItems){
                    this.dataForm.checkedItems=this.checkedItems
                }
                updateItemInfo(this.dataForm).then(result => {
                    if(result.data.code == 0) {
                        this.$message.success('保存成功')
                        this.visible = false
                        this.$emit('refreshDataList')
                    }
                })
            },
            finish() {
                if(!this.registerForm.id){
                    this.$message.warning('请选择就诊数据')
                    return false
                }
                this.optometry.optType=this.optType
                let params = {
                    optometry: filterParams(this.optometry),
                    chkData: filterParams(this.dataForm)
                }
                this.optometry.personId=this.dataForm.personId
                this.optometry.dataId=this.dataForm.id
                this.optometry.dataTbl='chk_data'
                if( this.optometry.id&& this.optometry.id!=0){
                    updateSaleOptometry(this.optometry).then(result => {
                        if(result.data.code == 0) {
                        }
                    })
                }else{
                    saveSaleOptometry(this.optometry).then(result => {
                        if(result.data.code == 0) {
                        }
                    })
                }
                finishChkData(params).then(result => {
                    if(result.data.code == 0) {
                        this.$message.success('保存成功')
                        this.visible = false
                        this.$emit('refreshDataList')
                    }
                })
            },
            saveInfo() {
                if(!this.registerForm.id){
                    this.$message.warning('请选择就诊数据')
                    return false
                }
                this.optometry.optType=this.optType
                this.optometry.personId=this.dataForm.personId
                this.optometry.dataId=this.dataForm.id
                this.optometry.dataTbl='chk_data'
                let params = {
                    optometry: this.optometry,
                    chkData: this.dataForm
                }
                if( this.optometry.id&& this.optometry.id!=0){
                    updateSaleOptometry(this.optometry).then(result => {
                        if(result.data.code == 0) {
                        }
                    })
                }else{
                    saveSaleOptometry(this.optometry).then(result => {
                        if(result.data.code == 0) {
                        }
                    })
                }
                saveChkData(params).then(result => {
                    if(result.data.code == 0) {
                        this.$message.success('保存成功')
                        this.visible = false
                        this.$emit('refreshDataList')
                    }
                })
            },
            //  录入检查结果
            recordCheckResult() {
                this.resultVisible = true
                this.$nextTick(() => {
                    this.$refs.checkResult.init()
                })
            }


        }
    }
</script>

<style lang="scss" scoped>
  table tr td {
    border: solid 1px red;
    padding: 8px;
  }

  .custom-info-box {
    border: solid 1px #e7e7e7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
    border-radius: 4px;
    background-color: #d1e0f8;
    margin-bottom: 15px;
  }

  .tabs-info-box {
    z-index: 1000;
  }

  .button-info-box {
    margin-top: 15px;
    text-align: right;
  }

  .custom-box {
    position: relative;
    display: flex;
    justify-content: flex-start;
    padding: 5px 15px;

    .custom-item {
      flex: auto;
    }
  }
</style>
